package com.quanyan.assets.mq;

import com.quanyan.assets.Constants.AssetsMqConstants;
import com.quanyan.mq.mq.producer.AbstractMqProducer;
import com.quanyan.orderpay.service.OrderPayService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * Created by wmb on 2016/7/14.
 */
@Component("mqProducer")
public class MqProducer extends AbstractMqProducer {
    @Value("${mq.nameServer.address}")
    private String nameServerAddress;


    @Override
    protected String getProducerGroup() {
        return AssetsMqConstants.ASSETS_GROUP_TAKS;
    }

    @Override
    protected String getNameServerAddress() {
        return this.nameServerAddress;
    }

    @Override
    protected String getInstanceName() {  //用于发送消息给不同的集群.
        return AssetsMqConstants.ASSETS_INSTANCE_TASK;
    }

    @PostConstruct
    void run() {
        super.start();
    }
}
